package com.wind.trademark.common.exception;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TmException extends Exception {

	private static final long serialVersionUID = -2396344394815479161L;

	// private static final String MESSAGE =
	// "Failed to execute your request as system error was encountered";

	public static final String STATUS_EXCEPTION = "exception";
 	public static final String STATUS_ERROR = "error";
	public static final String STATUS_NOTICE = "notice";
	public static final String STATUS_OK = "ok";
	public static final String STATUS_HELP = "help";

	private String errorCode;
	private Map<String, Object> errorModel;
	private List<Object> arguments = new ArrayList<Object>();

	/**
	 * 
	 */
	public TmException(String message) {
		super(message);
		this.errorCode = STATUS_NOTICE;
	}

	/**
	 * @param message
	 * @param cause
	 */
	public TmException(String errorCode, String message, Throwable cause) {
		super(message, cause);
		this.errorCode = errorCode;
	}

	/**
	 * @param message
	 */
	public TmException(String errorCode, String message) {
		super(message);
		this.errorCode = errorCode;
	}

	/**
	 * @param cause
	 */
	public TmException(String errorCode, Throwable cause) {
		super(cause);
		this.errorCode = errorCode;
	}

	/**
	 * 
	 */
	public TmException(String errorCode, Map<String, Object> errorModel) {
		super();
		this.errorCode = errorCode;
		this.errorModel = errorModel;
	}

	/**
	 * @param message
	 * @param cause
	 */
	public TmException(String errorCode, String message,
			Map<String, Object> errorModel, Throwable cause) {
		super(message, cause);
		this.errorCode = errorCode;
		this.errorModel = errorModel;
	}

	/**
	 * @param message
	 */
	public TmException(String errorCode, String message,
			Map<String, Object> errorModel) {
		super(message);
		this.errorCode = errorCode;
		this.errorModel = errorModel;
	}

	/**
	 * @param cause
	 */
	public TmException(String errorCode, Map<String, Object> errorModel,
			Throwable cause) {
		super(cause);
		this.errorCode = errorCode;
		this.errorModel = errorModel;
	}

	/**
	 * @return the errorCode
	 */
	public String getErrorCode() {
		return errorCode;
	}

	/**
	 * @param errorCode
	 *            the errorCode to set
	 */
	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public List<Object> addArgument(Object arg) {
		arguments.add(arg);
		return arguments;
	}

	/**
	 * @return the arguments
	 */
	public List<Object> getArguments() {
		return arguments;
	}

	/**
	 * @param arguments
	 *            the arguments to set
	 */
	public void setArguments(List<Object> arguments) {
		this.arguments = arguments;
	}

	/**
	 * @return the errorModel
	 */
	public Map<String, Object> getErrorModel() {
		return errorModel;
	}

	/**
	 * @param errorModel
	 *            the errorModel to set
	 */
	public void setErrorModel(Map<String, Object> errorModel) {
		this.errorModel = errorModel;
	}

}
